package com.heaven.back.pojo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * The type Item.
 */
@Slf4j
@Data
@AllArgsConstructor
public class Item {
    //可序列化的接口
    private final String name;
    private final String description;
    private final double weight;
    private int eatEffect = 0;
    private double eatValue = 0;

    /**
     * Instantiates a new Item.
     *
     * @param name        the name
     * @param description the description
     * @param weight      the weight
     */
    public Item(String name, String description, double weight) {
        this.name = name;
        this.description = description;
        this.weight = weight;
    }


    /**
     * Eat boolean.
     *
     * @param player the player
     * @return the boolean
     */
    public boolean eat(Player player) {
        if (eatEffect == 0) return false;
        player.setWeighmax(player.getWeighmax() + eatValue);
        log.info(String.valueOf(player.getWeighmax()));
        return true;
    }
}
